package br.ita.doacoes.view.voluntarios;

import javax.swing.JFrame;

import org.swingBean.actions.ApplicationAction;
import org.swingBean.gui.JActButton;

import br.ita.doacoes.core.templates.GenericDAOJPA;
import br.ita.doacoes.domain.voluntarios.TelefonePessoa;
import br.ita.doacoes.domain.voluntarios.Voluntario;
import br.ita.doacoes.view.cadastrodoacoes.refresher.Refreshable;
import br.ita.doacoes.view.cadastrodoacoes.refresher.Refresher;
import br.ita.doacoes.view.templates.CadastroMestreDetalhe;
import br.ita.doacoes.view.templates.CadastroSimples;

public class CadastroVoluntario extends CadastroSimples implements Refreshable{

	protected JActButton botaoPesquisa;
	
	public CadastroVoluntario() {
		click = false;
		refresh();
		Refresher.add(this);
	}

	@Override
	protected void createButtonPanel() {
		super.createButtonPanel();
		super.panelButton.add(botaoPesquisa);
	}

	@Override
	protected void createButtons() {
		super.createButtons();
		
		botaoPesquisa = new JActButton("Pesquisar",
				new ApplicationAction() {
					public void execute() {
						ConsultaVoluntario.main(null);
					}
				});
	}

	public void refresh() {
		if (click == false){
		removeAll();
		this.setClasse(Voluntario.class);
		this.setXmlForm("voluntarioForm.xml");
		this.setXmlTable("voluntarioTable.xml");
		this.setFormName("VoluntarioForm");
		this.setTableName("VoluntarioTable");
		this.setDao(new GenericDAOJPA(Voluntario.class));	
		this.init();
		}
	}



	
}
